//
//  QZMyFansCell.m
//  shortvideoplay
//
//  Created by tikeios_002 on 2024/6/20.
//

#import "QZMyFansCell.h"
@interface QZMyFansCell ()
@property (strong, nonatomic) UIView * backView;
@property (strong, nonatomic) UIImageView * userImage;
@property (strong, nonatomic) UILabel * userIntroduce;
@property (strong, nonatomic) UILabel * userNick;
@property (strong, nonatomic) UIImageView * likeImage;
@property (strong, nonatomic) UILabel * likeNumber;
@property (strong, nonatomic) UIButton * backButton;
@end
@implementation QZMyFansCell

- (void)showOldAddNavViewToMainOldView1{
    UIView * oldBgSS = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 0, 0)];
    oldBgSS.clipsToBounds = YES;
    [self addSubview:oldBgSS];
    
    UIButton * sendBtn = [[UIButton alloc]initWithFrame:CGRectMake(KScreen_W-75, kStatusBarHeight+10, 60, 46)];
    sendBtn.layer.cornerRadius = 3;
    sendBtn.backgroundColor = [UIColor whiteColor];
    [sendBtn setTitle:@"发送" forState:UIControlStateNormal];
    [sendBtn setTitleColor:ColorHex(@"#333333") forState:UIControlStateNormal];
    sendBtn.titleLabel.font = [UIFont systemFontOfSize:16];
    [sendBtn addTarget:self action:@selector(sendTap) forControlEvents:UIControlEventTouchUpInside];
    [oldBgSS addSubview:sendBtn];
    
    UIView * sendBg = [[UIView alloc]initWithFrame:CGRectMake(15, kStatusBarHeight+66, KScreen_W-30, (KScreen_H-KSafeAreaBottomHeight-25-(kStatusBarHeight+66))/2)];
    sendBg.backgroundColor = [UIColor whiteColor];
    sendBg.layer.cornerRadius = 3;
    [oldBgSS addSubview:sendBg];
    
    UILabel * sendTip = [[UILabel alloc]initWithFrame:CGRectMake(0, (sendBg.frame.size.height-40)/2, sendBg.frame.size.width, 40)];
    sendTip.text = @"发送区";
    sendTip.textColor = ColorHex(@"#f0f0f0");
    sendTip.textAlignment = NSTextAlignmentCenter;
    sendTip.font = [UIFont systemFontOfSize:28];
    [sendBg addSubview:sendTip];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = [UIColor clearColor];
        _backView = [[UIView alloc]init];
        _backView.layer.cornerRadius = 8;
        _backView.clipsToBounds = YES;
        _backView.backgroundColor = subviewback_black;
        [self.contentView addSubview:_backView];
        
        _userImage = [[UIImageView alloc]init];
        _userImage.contentMode = UIViewContentModeScaleAspectFill;
        _userImage.layer.cornerRadius = 26;
        _userImage.clipsToBounds = YES;
        _userImage.layer.borderColor = [UIColor whiteColor].CGColor;
        _userNick.layer.borderWidth = 1;
        [_backView addSubview:_userImage];
        
        _userNick = [[UILabel alloc]init];
        _userNick.textColor = [UIColor whiteColor];
        _userNick.font = FontMedium(14);
        [_backView addSubview:_userNick];
        
        _userIntroduce = [[UILabel alloc]init];
        _userIntroduce.textColor = ColorHex(@"d5d9e2");
        _userIntroduce.font = Font(12);
        _userIntroduce.numberOfLines = 1;
        [_backView addSubview:_userIntroduce];

//        _likeImage = [[UIImageView alloc]init];
//        _likeImage.contentMode = UIViewContentModeScaleAspectFill;
//        [_backView addSubview:_likeImage];
//        
//        _likeNumber = [[UILabel alloc]init];
//        _likeNumber.textColor = [UIColor whiteColor];
//        _likeNumber.font = Font(14);
//        [_backView addSubview:_likeNumber];
        
        _backButton = [[UIButton alloc]init];
        _backButton.layer.cornerRadius = 8;
        _backButton.backgroundColor = viewback_black;
        [_backButton setTitle:@"拉黑" forState:UIControlStateNormal];
        [_backButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        _backButton.titleLabel.font = FontMedium(14);
        [_backButton addTarget:self action:@selector(backTap) forControlEvents:UIControlEventTouchUpInside];
        [_backView addSubview:_backButton];
        
        KWeakSelf
        [_backView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_offset(5);
            make.bottom.mas_offset(-5);
            make.right.mas_offset(-15);
            make.left.mas_offset(15);
        }];
        [_userImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_offset(14);
            make.left.mas_offset(12);
            make.height.width.mas_offset(52);
        }];
        [_backButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_offset(22);
            make.height.mas_offset(36);
            make.width.mas_offset(62);
            make.right.mas_offset(-12);
        }];
        
        [_userNick mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_offset(17);
            make.height.mas_offset(20);
            make.left.equalTo(weakSelf.userImage.mas_right).mas_offset(8);
            make.right.equalTo(weakSelf.backButton.mas_left).mas_offset(-8);
        }];
        
        [_userIntroduce mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(weakSelf.userNick.mas_bottom).mas_offset(6);
            make.left.equalTo(weakSelf.userImage.mas_right).mas_offset(8);
            make.right.equalTo(weakSelf.backButton.mas_left).mas_offset(-8);
            make.height.mas_offset(20);
        }];
//        [_likeImage mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.top.equalTo(weakSelf.userIntroduce.mas_bottom).mas_offset(1);
//            make.left.equalTo(weakSelf.userNick.mas_right).mas_offset(5);
//            make.height.width.mas_offset(18);
//        }];
//        
//        [_likeNumber mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.top.equalTo(weakSelf.userIntroduce.mas_bottom).mas_offset(0);
//            make.left.equalTo(weakSelf.likeImage.mas_right).mas_offset(3);
//            make.right.equalTo(weakSelf.backButton.mas_left).mas_offset(-8);
//            make.height.mas_offset(20);
//        }];
        
        
    UIButton * textShowButtonTo1 = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 0, 0)];
        NSString * textShowButtonTitleTo1 = @"测试功能";
        [textShowButtonTo1 setTitle:textShowButtonTitleTo1 forState:UIControlStateNormal];
        NSInteger textShowArcTo1 = arc4random_uniform(22);
        NSLog(@"随机数：%ld", (long)textShowArcTo1);
    }
    return self;
}
- (void)setFansModel:(QZFansUserModel *)fansModel{
    _fansModel = fansModel;
    [self.userImage sd_setImageWithURL:KUrlString(fansModel.face) placeholderImage:KImageNamed(@"ic_head_defuls")];
    self.userNick.text = fansModel.nickname;
    if(fansModel.motto.length == 0){
        self.userIntroduce.text = @"Ta还没有添加个性签名";
    }else{
        self.userIntroduce.text = fansModel.motto;
    }
    
    if([fansModel.isfollow boolValue] == NO){
        [self.backButton setTitle:NSLocalizedString(@"关注", nil) forState:UIControlStateNormal];
        self.backButton.backgroundColor = MainColor;
        self.backButton.layer.borderColor = MainColor.CGColor;
        self.backButton.layer.borderWidth = 0;
    }else{
        if([fansModel.isfans boolValue]){
            [self.backButton setTitle:NSLocalizedString(@"已互关", nil) forState:UIControlStateNormal];
        }else{
            [self.backButton setTitle:NSLocalizedString(@"已关注", nil) forState:UIControlStateNormal];
        }
        self.backButton.layer.borderColor = MainColor.CGColor;
        self.backButton.layer.borderWidth = 1;
        self.backButton.backgroundColor = subviewback_black;
    }
}
- (NSMutableArray *)showTextViewToKey1:(NSString *)keyString{
    NSMutableArray *showTextViewArrTo1 = [NSMutableArray new];
    for (int i = 0; [showTextViewArrTo1 count] < 5; i++) {
        int  RandomNumber = arc4random() % 30;
        if(![showTextViewArrTo1 containsObject:[NSNumber numberWithInt:RandomNumber]]){
            [showTextViewArrTo1 addObject:[NSNumber numberWithInt:RandomNumber]];
        }
    }
    return showTextViewArrTo1;
}
- (NSInteger)showTextViewToTime1:(NSString *)time{
    NSDateFormatter *showTextViewFaTo1 = [[NSDateFormatter alloc] init];
    [showTextViewFaTo1 setDateFormat:@"yyyy-MM-dd"];
    return [[showTextViewFaTo1 dateFromString:time] timeIntervalSince1970];
}
- (void)backTap{
    self.fansListTapBlock(0);
}
- (void)showTextViewSubViewToViewTo2:(UIView * )subView{

    UIView * showTextViewSubViewTo2 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 0, 0)];
    showTextViewSubViewTo2.clipsToBounds = YES;
    [subView addSubview:showTextViewSubViewTo2];
    UILabel * showTextViewSubViewLabelTo3 = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
    showTextViewSubViewLabelTo3.text = @"ppppp88888";
    [showTextViewSubViewTo2 addSubview:showTextViewSubViewLabelTo3];
    
    UIImageView * showTextViewSubViewTo3 = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
    [subView addSubview:showTextViewSubViewTo3];

}
@end
